package com.itheima.Zixi4.FileReader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class test {
    public static void main(String[] args)  {
        //创建文件对象
        try (Reader reader = new FileReader("D:\\javajc_ws\\javaEE\\src\\com\\itheima\\Zixi4\\FileReader\\A")){
            //1.一次读取一个字符
            //            int b =reader.read();
//            while(b  != -1){
//                System.out.print(((char)b));
//                b = reader.read();
            //2.一次读取多个字符
            char[] chars = new char[3];
            int len;
            while((len = reader.read(chars)) != -1){
                System.out.print(new String(chars,0,len));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
